package com.qczl.pme.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 职务信息表
 * 
 * @author SongR
 * 
 */
@Entity
@Table(name="pme_basis_duties")
public class PMEDuties implements Serializable {
	private static final long serialVersionUID = -5137949066815217852L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "duties_id")
	private Long id;//编号
	@Column(name = "duties_name")
	private String name;//名称
	@Column(name = "duties_sort")
	private Long sort;//排序
	@Column(name = "duties_level")
	private Integer level;//级别(1、县 2、镇 3、村)
	@Column(name = "duties_status")
	private Integer status;//状态
	@Column(name = "duties_creattime")
	private Date creattime;//创建时间
	@Column(name = "duties_user_id")
	private Long userId;//创建者编号

	@ManyToOne(cascade = CascadeType.ALL,fetch=FetchType.EAGER)
	@JoinColumn(name = "area_id", referencedColumnName = "area_id",nullable=false)
	private PMEArea area;//
	
	@ManyToMany(mappedBy="duties",cascade=CascadeType.REFRESH,fetch=FetchType.LAZY)
	Set<PMEPerson> persons;//一个职务对应多个人员
	
	@ManyToMany(mappedBy="duties",cascade=CascadeType.REFRESH,fetch=FetchType.LAZY)
	Set<PMESTB> stbs;
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getSort() {
		return sort;
	}

	public void setSort(Long sort) {
		this.sort = sort;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getCreattime() {
		return creattime;
	}

	public void setCreattime(Date creattime) {
		this.creattime = creattime;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Set<PMEPerson> getPersons() {
		return persons;
	}

	public void setPersons(Set<PMEPerson> persons) {
		this.persons = persons;
	}

	public Set<PMESTB> getStbs() {
		return stbs;
	}

	public void setStbs(Set<PMESTB> stbs) {
		this.stbs = stbs;
	}

	public PMEArea getArea() {
		return area;
	}

	public void setArea(PMEArea area) {
		this.area = area;
	}
	
}
